package com.quiz.source;

import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

@SuppressWarnings("unused")
public class result extends Activity{
	
	TextView result;

	ImageView img;
	
	ImageButton again;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		String final_result = getIntent().getStringExtra("result");
		super.onCreate(savedInstanceState);
		setContentView(R.layout.result);
		final MediaPlayer mpButtonClick = MediaPlayer.create(this, R.raw.button_click);
		result = (TextView) findViewById(R.id.result);
		img = (ImageView) findViewById(R.id.img_result);
		again = (ImageButton) findViewById(R.id.again);
		//Toast.makeText(this, final_result, Toast.LENGTH_SHORT).show();
		//result.setText(final_result);
		
		Float score = Float.parseFloat(final_result);
		//String str = Integer.toString(score);
		//result.setText(str);
		
		float percentage = (score/5) * 100 ;
		if(percentage >= 80)
		{
			//img.getBackground();
			
		}
		String str = Float.toString(percentage);
		result.setText(str);
		
		again.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				startActivity(new Intent("com.quiz.source.CLEARSCREEN"));
				
			}
		});
		
		
	}
	
	

}
